<?php

namespace app\admin\controller\merchant;

/**
 * 店铺管理
 *
 */
class StoreCurrentLimiting extends Base
{
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = loader('admin')->loadModel('StoreCurrentLimiting');
    }

    /**
     * 查看
     */
    public function index()
    {
        //设置过滤方法
        $this->request->filter(['strip_tags', 'trim']);
        if ($this->request->isAjax()) {
            //如果发送的来源是Selectpage，则转发到Selectpage
            if ($this->request->request('keyField')) {
                return $this->selectpage();
            }
            $model = $this->model;
            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
            $model->where($where);
            $model->order($sort, $order);
            $list = $model->paginate($limit);
            $result = array("total" => $list->total(), "rows" => $list->items());
            return json($result);
        }
        return $this->view->fetch();
    }
}
